/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package net.easoftware.code.beans.cargas.impl;

import java.io.Serializable;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import net.easoftware.code.beans.cargas.AsOff;
import net.easoftware.code.beans.cargas.DataFilter;
import net.easoftware.code.beans.cargas.threading.CargasFilteringThread;
import net.easoftware.code.beans.cargas.threading.Result;
import net.easoftware.code.beans.facade.LineaNegocio;
import net.easoftware.code.beans.facade.RangoEmpresaFc;
import net.easoftware.code.error.EaError;

/**
 *
 * @author eliu
 */
public class AsOffFilter implements DataFilter, Serializable {

    private static List<RangoEmpresaFc> rangos = new LinkedList<RangoEmpresaFc>();
    private static Map<String, LineaNegocio> lineas = new HashMap<String, LineaNegocio>();

    @Override
    public Result proccesBean(Object bean, CargasFilteringThread parent) throws EaError {
        AsOff aso = (AsOff) bean;
        boolean rango = false;
        boolean linea = false;
        Result r = new Result(false, false);
        r.setCurrentBean(aso);

        return r;
        /*
         if (aso.getCompania() == null || aso.getDescproducto() == null) {
         r.setContieneLn(aso.getDescproducto() != null);
         r.setContieneUn(aso.getCompania() != null);
         r.setCurrentBean(null);
         return r;
         }
         if (lineas == null || lineas.isEmpty()) {
         for (LineaNegocio ln : parent.getLineasNegocio()) {
         lineas.put(ln.getPrefijo(), ln);
         }
         }
         if (rangos == null || rangos.isEmpty()) {
         rangos = parent.getRangos();
         }
         for (RangoEmpresaFc ref : rangos) {
         if (ref.getCodigoFin() >= aso.getCompania().intValue() && ref.getCodigoInicio() <= aso.getCompania().intValue()) {
         aso.setUn(ref.getUnidadNegocio().getId());
         rango = true;
         break;
         }
         }

         LineaNegocio ln = lineas.get(aso.getDescproducto());
         if (ln != null) {
         aso.setLn(ln.getId());
         linea = true;
         }
         r.setContieneLn(linea);
         r.setContieneUn(rango);

         return r;*/
    }
}
